﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/SiteMaster.Master"
    Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<%@ Import Namespace="Microhard.Framework.MVCHelper" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    检查项维护
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class="section-header">
        <div class="title">
            <img src="<%=Url.Content("~/Content/images/ico-catalog.png")%>" alt="" />
          检查项维护
        </div>
        <div class="options">
        </div>
    </div>
    <table width="50%">
        <tr>
            <td class="adminTitle">
                <img alt="模板名称" src="<%=Url.Content("~/Content/images/ico-help.gif") %>" title="模板名称"></img><label
                    for="operationName" title="模板名称">模板名称</label>:
            </td>
            <td class="adminData">
                <%--会影响当前页面的Operation--%>
               
                <%Html.RenderAction("GetIspTemplateList", "IspTemplate", new { area = "Inspection", ctrAttr = new Microhard.WebUI.Models.AttriubteOfSelectList { ParameterModelName = "SelectedTemplateID", IsMulitiplySelect = false, DefaultSelectedText = "请选择", DefaultSelectedValue = Guid.Empty.ToString() } });%>
               </td>
            <td>
             <%=Html.ActionLink("预览", "Preview", "IspItem", null, new { @class = "t-button" })%>
            </td>
           
        </tr>
    </table>
    <p>
    </p>
    <table class="adminContent">
        <tr>
            <td>
                <%Html.Telerik().Grid<Micrhard.FMCG.Server.Models.IspItemModel>((List<Micrhard.FMCG.Server.Models.IspItemModel>)this.Model.Data)
                    .Name("operation-grid")
                    .ToolBar(t => t.Template(g =>
                    { %>
                <%var searchParms = new Dictionary<string, string>();
                  searchParms.Add("TemplateID", "SelectedTemplateID");
                %>
                <div class="header-menu">
                    <ul class="t-widget t-reset t-header t-menu">
                        <li class="t-item  t-state-default">
                            <%=Html.Authorized_SearchButton("btnSearch", "查询", "operation-grid", searchParms, "OperationGridOnGridDataBinding")%>
                        </li>
                        <li class="t-item  t-state-default">
                            <%=Html.Authorized_AddButton("btnAdd", "添加", "Create", "IspItem")%>
                        </li>
                        <li class="t-item  t-state-default">
                            <%=Html.Authorized_UpdateButton("btnUpdate", "修改", "operation-grid", "Update", "IspItem", "Inspection")%>
                        </li>
                        <li class="t-item  t-state-default">
                            <%=Html.Authorized_DeleteButton("btnDelete", "删除", "operation-grid", "Delete", "IspItem", "Inspection")%>
                        </li>                      
                    </ul>
                </div>
                <%}))
                         .ClientEvents(events => events.OnDataBinding("OperationGridOnGridDataBinding"))
                         .Columns(columns =>
                         {
                             columns.Bound(x => x.CheckListItemID)
                            .Template(x => Html.CheckBox("checkedRecords", new { value = x.CheckListItemID, @class = "gridCks" }))
                            .ClientTemplate("<input type='checkbox' name='checkedRecords' value='<#= CheckListItemID #>' class='gridCks'/>")
                          .HtmlAttributes(new { style = "text-align:center" }).Title("选择");

                             columns.Bound(x => x.CategoryName).Title("类别名称");
                             columns.Bound(x => x.Sort).Title("排序");
                             columns.Bound(x => x.Name).Title("检查项名称");
                             columns.Bound(x => x.TypeToDisplay).Title("答题类型");
                             columns.Bound(x => x.CheckListItemID)
                                 .Template(x => Html.ActionLink("设置", "IspItemSet", "IspItem", new { id = x.CheckListItemID }, new { style = x.DisplayCSS }))
                                    .ClientTemplate("<a href='#' onclick=setLocation('<#= CheckListItemID #>')  >设置</a>")                                   
                                 .HtmlAttributes(new { style = "text-align:center" }).Title("答题明细");                                
                            
                         })
                      .Pageable(settings => settings.Total(Model.Total).PageSize(Html.GetGridPageSize()).Position(GridPagerPosition.Top))
                      //绑定搜索按钮，执行对应的action
                    .DataBinding(dataBinding => dataBinding.Ajax().Select("_List", "IspItem"))
                    .EnableCustomBinding(true)
                    .Render();
                %>
            </td>
        </tr>
    </table>
    <script type="text/javascript">
        function setLocation(id) {
           var url = "<%=Url.Content("~/Inspection/IspItem/IspItemSet?id=")%>" + id;
           window.open(url,"设置检查项");
        }
    </script>
</asp:Content>
